--town4 -"Grimsby"

function autoexec()
if (get_progress(P_CARAVEL) < 1 or get_progress(P_CARAVEL) == 2) then 
    LOC_move_caravel()
    set_ent_active(4,0)
   
 end

 if (get_progress(P_CHORES) <= 6 or get_progress(P_REBELLION ) >= 1) then 
    LOC_remove_ship()
 end
      
end

function refresh()
  return
end

function postexec()


end

function zone_handler(zn)
  if (zn == 1) then
    change_map("land","grimsby_exit");

  elseif (zn == 2) then
  --  touch_fire(get_pidx(0));

  elseif (zn == 10) then
    if (get_progress(P_SPLASH) < 1) then
      msg("SPLASH", 255, 0);
      set_progress(P_SPLASH,1);
    end


	
  end
end

function entity_handler(en)
  if (en == 0) then
    if (get_progress(P_CHORES) <= 6) then
      bubble(en, "Its not good for a sailor to be without a ship.");
    else
      bubble(en,"This here ship is a trading vessel all the way from Lanaerta.");
    end
    
  elseif  (en == 1) then
    bubble(HERO1,"Do many ships come through here?");
    bubble(en,"A fair amount for how remote this island is.");


  elseif  (en == 2) then 
    bubble(en,"I like flowers. Do you like flowers?");
    bubble(HERO1,"Hmm I haven't put much thought to it before.");
    bubble(HERO1,"There alright I suppose."); 

  elseif  (en == 3) then
    bubble(en,"Mother doesn't like us to play near the docks.")
    bubble(en,"So we play around the fire pit just north a' here.")
    bubble(en,"I like to go swimming up there, where the water isnt so deep.")

  elseif  (en == 4) then
    if (prompt(en,2,0,"Would you like to take a ride to the island of Thessalia for a mere 250 gold?","  yes","  no","") == 0) then 
      if (get_gp() < 250) then
        bubble(en,"Ya trying to cheat me. Thats not enough gold.");
      elseif (get_gp() >= 250) then
        set_gp(get_gp() - 250)
        msg("You pay Captain Finch 250 gold.")
        bubble(en,"Alright let's set sail.");
        set_ent_chrx(HERO1, 34)
        if (get_numchrs() == 2) then
          set_ent_chrx(HERO2, 98)
        end
        change_map("land","harbor_exit");
        set_progress(P_CARAVEL,2);  
      end 
    else
      bubble(en,"Well come back by another time.");
   end
    
end
       end 

function LOC_remove_ship()

--front tiles
set_obs("s5",1)
set_btile("s5", 160)--716

--middle tiles 
set_mtile("s1", 000) --698
set_mtile("s2", 000) --697
set_mtile("s3", 000) --695
set_mtile("s4", 000) --696
set_mtile("s6", 000) --695
set_mtile("s7", 000) --696
set_mtile("s8", 000) --694
set_mtile("s9", 000) --693
set_mtile("s10", 000)--679
set_mtile("s11", 000)--678
set_mtile("s12", 000)--677
set_mtile("s13", 000)--676
set_mtile("s14", 000)--676
set_mtile("s15", 000)--676
set_mtile("s16", 000)--676
set_mtile("s17", 000)--675
set_mtile("s18", 000)--674
set_mtile("s19", 000)--673
set_mtile("s20", 000)--681
set_mtile("s21", 000)--680
set_mtile("s25", 000)--688
set_mtile("s26", 000)--680
set_mtile("s27", 000)--672
set_mtile("s28", 000)--671
set_mtile("s32", 000)--686

--back tiles 
set_ftile("s12", 000)--682
set_ftile("s14", 000)--690
set_ftile("s16", 000)--690
set_ftile("s17", 000)--682
set_ftile("s20", 000)--692
set_ftile("s21", 000)--691

set_ftile("s22", 000)--689
set_ftile("s23", 000)--688
set_ftile("s24", 000)--689
set_ftile("s25", 000)--681

set_ftile("s42", 000)--713
set_ftile("s43", 000)--712
set_ftile("s29", 000)--687
set_ftile("s30", 000)--686
set_ftile("s31", 000)--687
set_ftile("s32", 000)--713
set_ftile("s33", 000)--712
set_ftile("s34", 000)--685
set_ftile("s35", 000)--684
set_ftile("s36", 000)--685
set_ftile("s37", 000)--684
set_ftile("s38", 000)--683
set_ftile("s39", 000)--714 or 715
set_ftile("s40", 000)--683
set_ftile("s41", 000)--714 or 715

end


function LOC_move_caravel()

--front tiles
set_obs("c3",1)
set_btile("c3", 160)

--middle tiles 
set_mtile("c1", 000)
set_mtile("c2", 000)
set_mtile("c4", 000)
set_mtile("c5", 000)
set_mtile("c6", 000)
set_mtile("c7", 000)
set_mtile("c8", 000)
set_mtile("c9", 000)
set_mtile("c10", 000)
set_mtile("c11", 000)
set_mtile("c12", 000)
set_mtile("c13", 000)
set_mtile("c14", 000)
set_mtile("c15", 000)
set_mtile("c16", 000)
set_mtile("c17", 000)
set_mtile("c18", 000)
set_mtile("c20", 000)


--back tiles 
set_ftile("c26", 000)
set_ftile("c10", 000)
set_ftile("c11", 000)
set_ftile("c14", 000)
set_ftile("c15", 000)
set_ftile("c19", 000)
set_ftile("c20", 000)
set_ftile("c21", 000)
set_ftile("c22", 000)
set_ftile("c23", 000)
set_ftile("c24", 000)
set_ftile("c25", 000)


end





